package pingji.service.login.impl;

import jdk.internal.dynalink.linker.LinkerServices;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import pingji.controller.ResponseObject;
import pingji.controller.login.LoginObject;
import pingji.controller.login.LoginResponse;
import pingji.dao.login.LoginDao;
import pingji.pojo.ResponseUser;
import pingji.service.login.LoginService;

import javax.xml.ws.spi.WebServiceFeatureAnnotation;

@Service
public class LoginServiceImpl implements LoginService {
    @Autowired
    LoginDao dao;
    @Override
    public LoginResponse loginService(LoginObject o) {
        LoginResponse resp=new LoginResponse();
        int login = dao.login(o);
        if(login==-1){
            resp.code=1;
            resp.message="用户名或密码错误";
            resp.id=-1;
            return resp;
        }
        resp.code=0;
        resp.message="登录成功";
        resp.id=login;
        return resp;
    }
}
